package com.cssy.base.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cssy.base.dao.SysEntityuniquDAO;
import com.cssy.base.entity.SysEntityuniquDO;
import com.cssy.base.service.ISysEntityService;
import com.cssy.base.vo.SysEntityuniquVO;
import com.plat.exception.SyBaseException;
@Service("sysEntityService")
public class SysEntityServiceImpl implements ISysEntityService {

	@Resource(name="sysEntityuniquDAO")
	private SysEntityuniquDAO sysEntityuniquDAO;
	@Override
	public List<SysEntityuniquDO> findSysEntityuniquVoByClassName(
			String className)throws SyBaseException {
		SysEntityuniquDO sysEntityuniquDO=new SysEntityuniquDO();
		sysEntityuniquDO.setCalssname(className);
		return sysEntityuniquDAO.findListByExample(sysEntityuniquDO);
	}
	@Override
	public List<Map> findSysEntityuniquByClassName(Class zclass,
			Object value) throws SyBaseException{
		SysEntityuniquDO sysEntityuniquDO=new SysEntityuniquDO();
		sysEntityuniquDO.setCalssname(zclass.getName());
		List<SysEntityuniquDO> clist=sysEntityuniquDAO.findListByExample(sysEntityuniquDO);
		if(clist==null ||clist.isEmpty()){
			throw new SyBaseException("查询配置不存在！");
		}else{
			SysEntityuniquDO cent=clist.get(0);
			SysEntityuniquVO vo=SysEntityuniquVO.convert(cent);
			vo.setQvalue(value);
			return sysEntityuniquDAO.findUniquListByMap(vo);
			
		}
	}
	

}
